package com.cc.user.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.cc.user.dao.ReceiveAddressDao;
import com.cc.user.entity.ReceiveAddressEntity;
import com.cc.user.service.ReceiveAddressService;


@Service("receiveAddressService")
public class ReceiveAddressServiceImpl extends ServiceImpl<ReceiveAddressDao, ReceiveAddressEntity> implements ReceiveAddressService {


    @Override
    public List<ReceiveAddressEntity> getallReceiveAddr(Long uid) {
        ReceiveAddressDao receiveAddressDao = this.baseMapper;
        return receiveAddressDao.selectList(new QueryWrapper<ReceiveAddressEntity>().eq("uid",uid));
    }

    @Override
    public int deleteOneReceiveAddr(Long id) {
        ReceiveAddressDao receiveAddressDao = this.baseMapper;
        return receiveAddressDao.delete(new QueryWrapper<ReceiveAddressEntity>().eq("id",id));
    }

    @Override
    public int addReceiveAddr(ReceiveAddressEntity receiveAddressEntity) {
        ReceiveAddressDao receiveAddressDao = this.baseMapper;
        return receiveAddressDao.insert(receiveAddressEntity);
    }

    @Override
    public int deleteMutiReceiveAddr(List<Long> id_list) {
        ReceiveAddressDao receiveAddressDao = this.baseMapper;
        return receiveAddressDao.deleteMutiReceiveAddr(id_list);
    }
}